#include<iostream>
using namespace std;
#include<vector>
#include<algorithm>
class Solution {
public:
    int findMinArrowShots(vector<vector<int>>& points) {
        sort(points.begin(), points.end(), [](vector<int>& a1, vector<int>& a2) {return a1[1] < a2[1]; });
        int ans = 1, n = points.size();
        for (int left = 0, right = 0; right < n; ++right) {
            if (points[right][0] > points[left][1]) {
                ++ans;
                left = right;
            }
        }
        return ans;
    }
};